<template>
  <div class="header">
    <i class="hicon" @click="hclick"></i>
    <span class="bt"><slot></slot></span>
    <div class="icon">
      <i class="cicon" @click="cclick"></i>
      <i class="bsicon"></i>
      <i class="cartnum">{{$store.state.cartList.length}}</i>
    </div>
  </div>
</template>
<script>
export default {
  name:"NavBar",
  methods: {
    hclick() {
      this.$router.push('/home/itemlist/1005000');
    },
    cclick() {
      this.$router.push('/cart');
    }
  }
}
</script>
<style scoped>
.header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 44px;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid #d8c7c7;
  z-index: 4;
}
.hicon {
  flex: 1;
  /* width: 24px; */
  height: 22px;
  background-image: url(~assets/images/jlt2.png);
  background-size: 119px 101.5px;
  background-repeat: no-repeat;
  background-position: 0 -79.5px;
}
.bt {
  flex: 1;
  font-size: 18px;
  text-align: center;
}
.icon {
  position: relative;
  flex: 1;
}
.bsicon {
  float: right;
  width: 32px;
  height: 32px;
  background-image: url(~assets/images/jlt2.png);
  background-size: 119px 101.5px;
  background-repeat: no-repeat;
  background-position: -87px 0;
}
.cicon {
  float: right;
  width: 32px;
  height: 32px;
  background-image: url(~assets/images/jlt2.png);
  background-size: 119px 101.5px;
  background-repeat: no-repeat;
  background-position: -37px -28px;
  margin-left: 10px;
}
.cartnum {
  position: absolute;
  width: 14px;
  height: 14px;
  top: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  line-height: 14px;
  color: #fff;
  border-radius: 50%;
  background-color: #b4282d;
}
</style>